package gold.digger;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC477 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int totalHammingDistance(int[] nums) {
            int ans = 0;
            for (int i = 0; i < 32; i++) {
                int zero = 0, one = 0;
                for (int num : nums) {
                    if ((num & 1 << i) == (1 << i)) one++;
                    else zero++;
                }

                ans += zero * one;
            }

            return ans;
        }
    }

    public void run() {
        Solution solution = new Solution();
        List<Integer> list = new ArrayList<>();
        System.out.println(solution.toString());
    }

    public static void main(String[] args) throws Exception {
        LC477 an = new LC477();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
